/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.ac.iie.di.ban.jr.rest.server;

import cn.ac.iie.di.ban.jr.rest.handlers.Handler;
import cn.ac.iie.di.commons.httpserver.framework.server.HttpServer;
import org.apache.log4j.Logger;

/**
 *
 * @author zwlin
 */
public class Server {

	private static final Logger logger = Logger.getLogger(Server.class);

	HttpServer server;

	public Server(String bindIp, int bindPort, int parallelSize) throws Exception {
		server = HttpServer.getHttpServer(bindIp, bindPort, parallelSize);
		server.registerContext("/wxyq");
		server.registerContextHandler("/wxyq", "/", Handler.class);
	}

	public void start() throws Exception {
		server.startup();
	}

	public void stop() throws Exception {
		server.shutdown();
	}
}
